/*
 * dht11.h
 *
 *  Created on: Mar 9, 2014
 *      Author: Trong Than
 */

#ifndef DHT11_H_
#define DHT11_H_

#include <stdint.h>
#include <stdbool.h>

#ifdef __cplusplus
extern "C"
{
#endif

#define DHT11_SUCCESS        true
#define DHT11_ERROR          false
#define ON              true
#define OFF             false

typedef struct {
  uint32_t  ui32GPIOPort;
  uint32_t  ui32GPIOPin;
	uint8_t   IntHumidity;
	uint8_t   DecHumidity;
	uint8_t   IntTemperature;
	uint8_t   DecTemperature;
}tDHT11;

/********************************************************************************
 * Low level function
 */
extern void DHT11_Init(tDHT11 DHT11);
extern void DHT11_Delay_us(uint8_t ); // unit: us
extern void DHT11_Delay_ms(uint8_t ); // unit: ms
extern void DHT11_PinModeOutput(tDHT11* DHT11);
extern void DHT11_PinModeInput(tDHT11* DHT11);
extern int32_t DHT11_PinRead(tDHT11* DHT11);
extern void DHT11_PinWrite(tDHT11* DHT11,bool State);


/********************************************************************************
 * High level function
 */
extern bool DHT11_GetData(tDHT11* DHT11);

//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif


#endif /* DHT11_H_ */
